
import service from '@/utils/request'

// 查询所有角色
export const roleInfoApi = () => {
  return service({
    url: '/park/sys/role'
  })
}

// 查询所有页面功能 https://api-hmzs.itheima.net/api/park/sys/permision/all/tree
export const roleTreeperisionApi = () => {
  return service({
    url: '/park/sys/permision/all/tree'
  })
}

// 查询角色对应的权限信息  https://api-hmzs.itheima.net/api/park/sys/role/{roleId}
export const rolePermissionsInformationApi = (roleId) => {
  return service({
    url: `/park/sys/role/${roleId}`
  })
}

// 获取角色对应的用户列表 https://api-hmzs.itheima.net/api/park/sys/roleUser/{roleId}
export const usersInTheRoleApi = (roleId) => {
  return service({
    url: `/park/sys/roleUser/${roleId}`
  })
}

// 添加角色 https://api-hmzs.itheima.net/api/park/sys/role
export const addRoleApi = (data) => {
  return service({
    method: 'post',
    url: '/park/sys/role',
    data
  })
}

// 查询当前角色详情 https://api-hmzs.itheima.net/api/park/sys/role/{roleId}
export const roleShowInfoApi = (roleId) => {
  return service({
    url: `/park/sys/role/${roleId}`
  })
}

// 修改角色权限 https://api-hmzs.itheima.net/api/park/sys/role
export const roleEditInfoApi = (data) => {
  return service({
    method: 'put',
    url: '/park/sys/role',
    data
  })
}

// 删除角色 https://api-hmzs.itheima.net/api/park/sys/role/{id}
export const delRoleInfoApi = (roleid) => {
  return service({
    method: 'DELETE',
    url: `/park/sys/role/${roleid}`
  })
}

// 查询当前登录人的角色信息 https://api-hmzs.itheima.net/api/park/user/profile
export const userInRoleInfoApi = () => {
  return service({
    url: '/park/user/profile'
  })
}
